home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 21
/
AACD 21.iso
/
AACD
/
Resources
/
Online
/
Miami
/
MiamiSDK
/
doc
/
UserGroup.doc
< prev
Wrap
Text File
|
1997-12-23
|
23KB
|
1,024 lines
TABLE OF CONTENTS
usergroup.library/crypt
usergroup.library/endgrent
usergroup.library/endpwent
usergroup.library/endutent
usergroup.library/getcredentials
usergroup.library/getegid
usergroup.library/geteuid
usergroup.library/getgid
usergroup.library/getgrent
usergroup.library/getgrgid
usergroup.library/getgrnam
usergroup.library/getgroups
usergroup.library/getlastlog
usergroup.library/getlogin
usergroup.library/getpass
usergroup.library/getpgrp
usergroup.library/getpwent
usergroup.library/getpwnam
usergroup.library/getpwuid
usergroup.library/getuid
usergroup.library/getumask
usergroup.library/getutent
usergroup.library/initgroups
usergroup.library/setgid
usergroup.library/setgrent
usergroup.library/setgroups
usergroup.library/setlastlog
usergroup.library/setlogin
usergroup.library/setpwent
usergroup.library/setregid
usergroup.library/setreuid
usergroup.library/setsid
usergroup.library/setuid
usergroup.library/setutent
usergroup.library/ug_GetErr
usergroup.library/ug_GetSalt
usergroup.library/ug_SetupContextTagList
usergroup.library/ug_StrError
usergroup.library/umask
usergroup.library/crypt usergroup.library/crypt
NAME
crypt -- password encryption
SYNOPSIS
res = crypt( key, set );
D0 A0 A1
char *crypt( const char *key, const char *set );
FUNCTION
The crypt function performs password encryption. The algorithm used
for encryption is implementation-dependent.
The first argument to crypt is a NUL-terminated string (normally a
password typed by a user). The second is a character array, 9 bytes
in length, consisting of an underscore (``_'') followed by 4 bytes of
iteration count and 4 bytes of salt. Both the iteration count and
the salt are encoded with 6 bits per character, least significant
bits first. The values 0 to 63 are encoded by the characters
``./0-9A-Za-z'', respectively.
The salt is used to induce disorder into the encryption algorithm in
one of 16777216 possible ways. The value returned is a
NUL-terminated string, 20 bytes in length, consisting of the setting
followed by the encoded 64-bit encryption.
The function crypt() returns a pointer to the encrypted value on
success and NULL on failure.
INPUTS
key - password
set - setting
RESULT
res (D0) - result
usergroup.library/endgrent usergroup.library/endgrent
NAME
endgrent -- group database operations
SYNOPSIS
endgrent();
void endgrent (void);
FUNCTION
The function endgrent() releases any resources allocated by
setgrent().
This function has been deprecated.
usergroup.library/endpwent usergroup.library/endpwent
NAME
endpwent -- password database operations
SYNOPSIS
endpwent();
void endpwent (void);
FUNCTION
The function endpwent() releases any resources allocated by
setpwent().
This function has been deprecated.
usergroup.library/endutent usergroup.library/endutent
NAME
endutent -- utmp database operations
SYNOPSIS
endutent();
void endutent (void);
FUNCTION
The function endutent() releases any resources allocated by
setutent().
This function has been deprecated.
usergroup.library/getcredentials usergroup.library/getcredentials
NAME
getcredentials -- get the credentials of the specified task
SYNOPSIS
cred = getcredentials( task );
D0 A0
struct UserGroupCredentials *getcredentials( struct Task *task );
FUNCTION
Return the credentials of the specified exec task.
This function has been deprecated.
INPUTS
task - task
RESULT
cred (D0) - credentials
usergroup.library/getegid usergroup.library/getegid
NAME
getegid -- get group process identification
SYNOPSIS
id = getegid();
D0
uid_t getegid (void);
FUNCTION
The getegid() function returns the effective group ID of the calling
process.
The real group ID is the group of the user who invoked the program.
The effective group ID gives the process additional permissions
during the execution of ``set-group-ID'' mode processes.
RESULT
id (D0) - group id
usergroup.library/geteuid usergroup.library/geteuid
NAME
geteuid -- get user identification
SYNOPSIS
id = geteuid();
D0
uid_t geteuid (void);
FUNCTION
The getuid() function returns the effective user ID of the calling
process.
RESULT
id (D0) - user id
usergroup.library/getgid usergroup.library/getgid
NAME
getgid -- get group process identification
SYNOPSIS
id = getgid();
D0
uid_t getgid (void);
FUNCTION
The getgid() function returns the real group ID of the calling
process.
The real group ID is specified at login time.
The real group ID is the group of the user who invoked the program.
As the effective group ID gives the process additional permissions
during the execution of ``set-group-ID'' mode processes, getgid() is
used to determine the real-user-id of the calling process.
RESULT
id (D0) - group id
usergroup.library/getgrent usergroup.library/getgrent
NAME
getgrent -- group database operations
SYNOPSIS
grp = getgrent();
D0
struct group *getgrent (void);
FUNCTION
The function getgrent() sequentially reads the group database.
The functions getgrent() returns a valid pointer to a group structure
on success and a null pointer if the end of the database is reached
or an error occurs.
This function has been deprecated.
RESULT
grp (D0) - group entry
usergroup.library/getgrgid usergroup.library/getgrgid
NAME
getgrgid -- group database operations
SYNOPSIS
grp = getgrgid( gid );
D0 D0
struct group *getgrgid( gid_t gid );
FUNCTION
The function getgrgid() searches the group database for the given
group id, always returning the first one encountered. The function
getgrgid() returns a valid pointer to a group structure on success
and a null pointer if no matching entry is found.
INPUTS
gid - group id
RESULT
grp (D0) - group entry
usergroup.library/getgrnam usergroup.library/getgrnam
NAME
getgrnam -- group database operations
SYNOPSIS
grp = getgrnam( name );
D0 A1
struct group *getgrnam( char *name );
FUNCTION
The function getgrnam() searches the group database for the given
group name, always returning the first one encountered. The function
getgrnam() returns a valid pointer to a group structure on success
and a null pointer if no matching entry is found.
INPUTS
name - group name
RESULT
grp (D0) - group entry
usergroup.library/getgroups usergroup.library/getgroups
NAME
getgroups -- get group access list
SYNOPSIS
ret = getgroups( gidsetlen, gidset );
D0 D0 A1
int getgroups( int gidsetlen, gid_t *gidset );
FUNCTION
getgroups() gets the current group access list of the user process
and stores it in the array gidset. The parameter gidsetlen indicates
the number of entries that may be placed in gidset. getgroups()
returns the actual number of groups returned in gidset. No more than
NGROUPS, as defined in <sys/param.h>, will ever be returned.
A successful call returns the number of groups in the group set. A
value of -1 indicates that an error occurred, and the error code is
stored in the global variable errno.
The possible errors for getgroups() are:
[EINVAL] The argument gidsetlen is smaller than the number of groups
in the group set.
INPUTS
gidsetlen - gid set len
gidset - gid set
RESULT
ret (D0) - return code
usergroup.library/getlastlog usergroup.library/getlastlog
NAME
getlastlog -- get lastlog entry
SYNOPSIS
lastlog = getlastlog( uid );
D0 D0
struct lastlog *getlastlog( uid_t uid );
FUNCTION
Return the entry corresponding to the last login for the specified
user.
This function has been deprecated.
INPUTS
uid - user id
RESULT
lastlog (D0) - last login entry
usergroup.library/getlogin usergroup.library/getlogin
NAME
getlogin -- get login name
SYNOPSIS
login = getlogin();
D0
char *getlogin (void);
FUNCTION
The getlogin() routine returns the login name of the user associated
with the current session, as previously set by setlogin().
If a call to getlogin() succeeds, it returns a pointer to a
null-terminated string in a static buffer. If the name has not been
set, it returns NULL.
RESULT
login (D0) - login name
usergroup.library/getpass usergroup.library/getpass
NAME
getpass -- get a password
SYNOPSIS
pwd = getpass( prompt );
D0 A0
char *getpass( const char *prompt );
FUNCTION
The getpass() function displays a prompt and reads in a password in
an implementation-dependent way.
The password may be up to _PASSWORD_LEN (currently 128) characters in
length. Any additional characters and the terminating newline
character are discarded.
getpass() returns a pointer to the null terminated password.
INPUTS
prompt - prompt
RESULT
pwd (D0) - password
usergroup.library/getpgrp usergroup.library/getpgrp
NAME
getpgrp -- get process group
SYNOPSIS
process = getpgrp();
D0
pid_t *getpgrp (void);
FUNCTION
The process group of the current process is returned by getpgrp().
This function has been deprecated.
RESULT
process (D0) - process id
usergroup.library/getpwent usergroup.library/getpwent
NAME
getpwent -- password database operations
SYNOPSIS
pwd = getpwent();
D0
struct passwd *getpwent (void);
FUNCTION
The function getpwent() sequentially reads the user database.
The functions getpwent() returns a valid pointer to a passwd
structure on success and a null pointer if the end of the database is
reached or an error occurs.
This function has been deprecated.
RESULT
pwd (D0) - password entry
usergroup.library/getpwnam usergroup.library/getpwnam
NAME
getpwnam -- password database operations
SYNOPSIS
pwd = getpwnam( login );
D0 A1
struct passwd *getpwnam( char *login );
FUNCTION
The function getpwnam() searches the password database for the given
login name, always returning the first one encountered. The function
getpwnam() returns a valid pointer to a passwd structure on success
and a null pointer if no matching entry is found.
INPUTS
login - login name
RESULT
pwd (D0) - password entry
usergroup.library/getpwuid usergroup.library/getpwuid
NAME
getpwuid -- password database operations
SYNOPSIS
pwd = getpwuid( uid );
D0 d0
struct passwd *getpwuid( uid_t *uid );
FUNCTION
The function getpwuid() searches the password database for the given
user uid, always returning the first one encountered. The function
getpwuid() returns a valid pointer to a passwd structure on success
and a null pointer if no matching entry is found.
INPUTS
uid - user id
RESULT
pwd (D0) - password entry
usergroup.library/getuid usergroup.library/getuid
NAME
getuid -- get user identification
SYNOPSIS
id = getuid();
D0
uid_t getuid (void);
FUNCTION
The getuid() function returns the real user ID of the calling
process.
RESULT
id (D0) - user id
usergroup.library/getumask usergroup.library/getumask
NAME
getumask -- set file creation mode mask
SYNOPSIS
ret = getumask();
D0
mode_t getumask (void);
FUNCTION
Return the current file creation mask.
RESULT
ret (D0) - old mask
usergroup.library/getutent usergroup.library/getutent
NAME
getutent -- utmp database operations
SYNOPSIS
ent = getutent();
D0
struct utmp *getutent (void);
FUNCTION
The function getutent() sequentially reads the utmp database.
The functions getutent() returns a valid pointer to a utmp structure
on success and a null pointer if the end of the database is reached
or an error occurs.
This function has been deprecated.
RESULT
ent (D0) - utmp entry
usergroup.library/initgroups usergroup.library/initgroups
NAME
initgroups -- initialize group access list
SYNOPSIS
ret = initgroups( name, basegid );
D0 A1 D0
int initgroups( char *name, int basegid );
FUNCTION
The initgroups() function calculates the group access list for the
user specified in name. This group list is then setup for the
current process using setgroups(). The basegid is automatically
included in the groups list. Typically this value is given as the
group number from the password file.
The initgroups() function returns -1 if it was not invoked by the
super-user.
INPUTS
name - user name
basegid - base gid
RESULT
ret (D0) - return code
usergroup.library/setgid usergroup.library/setgid
NAME
setgid -- set group ID
SYNOPSIS
ret = setgid( rgid, egid );
D0 D0 D1
int setgid( gid_t rgid, gid_t egid );
FUNCTION
The setgid() function sets the real and effective group IDs and the
saved set-group-ID of the current process to the specified value.
The setgid() function is permitted if the specified ID is equal to
the real group ID of the process, or if the effective user ID is that
of the super user.
Upon success, the function returns 0; otherwise -1 is returned.
If the user is not the super user, or the uid specified is not the
real, effective ID, or saved ID, these functions return -1.
INPUTS
rgid - real group id
egid - effective group id
RESULT
ret (D0) - return code
usergroup.library/setgrent usergroup.library/setgrent
NAME
setgrent -- group database operations
SYNOPSIS
ret = setgrent();
D0
int setgrent (void);
FUNCTION
The function setgrent() rewinds the group database.
The function setgrent() returns 0 on failure and 1 on success.
This function has been deprecated.
RESULT
ret (D0) - return code
usergroup.library/setgroups usergroup.library/setgroups
NAME
setgroups -- set group access list
SYNOPSIS
ret = setgroups( gidsetlen, gidset );
D0 D0 A1
int setgroups( int gidsetlen, gid_t *gidset );
FUNCTION
setgroups() sets the group access list of the current user process
according to the array gidset. The parameter ngroups indicates the
number of entries in the array and must be no more than NGROUPS, as
defined in <sys/param.h>.
Only the super-user may set new groups.
A 0 value is returned on success, -1 on error, with an error code
stored in errno.
The setgroups() call will fail if:
[EPERM] The caller is not the super-user.
INPUTS
gidsetlen - gid set len
gidset - gid set
RESULT
ret (D0) - return code
usergroup.library/setlastlog usergroup.library/setlastlog
NAME
setlastlog -- set lastlog entry
SYNOPSIS
lastlog = setlastlog( uid, name, host );
D0 D0 A0 A1
struct lastlog *setlastlog( uid_t uid, char *name, char *host );
FUNCTION
Set the login entry for the specified user.
This function has been deprecated.
INPUTS
uid - user id
name - name
host - host
RESULT
lastlog (D0) - last login entry
usergroup.library/setlogin usergroup.library/setlogin
NAME
setlogin -- set login name
SYNOPSIS
login = setlogin();
A1
char *setlogin (void);
FUNCTION
setlogin() sets the login name of the user associated with the
current session to name. This call is restricted to the super-user,
and is normally used only when a new session is being created on
behalf of the named user (for example, at login time, or when a
remote shell is invoked).
If a call to setlogin() succeeds, a value of 0 is returned. If
setlogin() fails, a value of -1 is returned and an error code is
placed in the global location errno.
The following errors may be returned by these calls:
[EINVAL] The name parameter pointed to a string that was too long.
Login names are limited to MAXLOGNAME (from <sys/param.h>)
characters, currently 12.
[EPERM] The caller tried to set the login name and was not the
super-user.
RESULT
login (A1) - login name
usergroup.library/setpwent usergroup.library/setpwent
NAME
setpwent -- password database operations
SYNOPSIS
ret = setpwent();
D0
int setpwent (void);
FUNCTION
The function setpwent() rewinds the password database.
The function setpwent() returns 0 on failure and 1 on success.
This function has been deprecated.
RESULT
ret (D0) - return code
usergroup.library/setregid usergroup.library/setregid
NAME
setregid -- set real and effective group ID
SYNOPSIS
ret = setregid( rgid, egid );
D0 D0 D1
int setregid( gid_t rgid, gid_t egid );
FUNCTION
The real and effective group ID's of the current process are set to
the arguments. Unprivileged users may change the real group ID to
the effective group ID and vice-versa; only the super-user may make
other changes.
Supplying a value of -1 for either the real or effective group ID
forces the system to substitute the current ID in place of the -1
parameter.
When setting the real and effective group IDs to the same value, the
standard setgid() function is preferred.
Upon success, the function returns 0; otherwise -1 is returned.
If the user is not the super user, or the uid specified is not the
real, effective ID, or saved ID, these functions return -1.
INPUTS
rgid - real group id
egid - effective group id
RESULT
ret (D0) - return code
usergroup.library/setreuid usergroup.library/setreuid
NAME
setreuid -- set real and effective user IDs
SYNOPSIS
ret = setreuid( ruid, euid );
D0 D0 D1
int setreuid( uid_t ruid, uid_t euid );
FUNCTION
The real and effective user IDs of the current process are set
according to the arguments. If ruid or euid is -1, the current uid
is filled in by the system. Unprivileged users may change the real
user ID to the effective user ID and vice-versa; only the super-user
may make other changes.
When setting the real and effective user IDs to the same value, the
standard setuid() function is preferred.
Upon successful completion, a value of 0 is returned. Otherwise, a
value of -1 is returned and errno is set to indicate the error.
Possible errors:
[EPERM] The current process is not the super-user and a change other
than changing the effective user-id to the real user-id was
specified.
INPUTS
ruid - real user id
euid - effective user id
RESULT
ret (D0) - return code
usergroup.library/setsid usergroup.library/setsid
NAME
setsid -- create session and set process group ID
SYNOPSIS
process = setsid();
D0
pid_t *setsid (void);
FUNCTION
The setsid function creates a new session. The calling process is
the session leader of the new session, is the process group leader of
a new process group and has no controlling terminal. The calling
process is the only process in either the session or the process
group.
Upon successful completion, the setsid function returns the value of
the process group ID of the new process group, which is the same as
the process ID of the calling process.
If an error occurs, setsid returns -1 and the global variable errno
is set to indicate the error, as follows:
[EPERM] The calling process is already a process group leader, or the
process group ID of a process other than the calling process matches
the process ID of the calling process.
RESULT
process (D0) - process id
usergroup.library/setuid usergroup.library/setuid
NAME
setuid -- set user id
SYNOPSIS
ret = setuid( uid );
D0 D0
int setuid( uid_t uid );
FUNCTION
The setuid() function sets the real and effective user IDs and the
saved set-user-ID of the current process to the specified value. The
setuid() function is permitted if the specified ID is equal to the
real user ID of the process, or if the effective user ID is that of
the super user.
Upon success, the function returns 0; otherwise -1 is returned.
If the user is not the super user, or the uid specified is not the
real, effective ID, or saved ID, these functions return -1.
INPUTS
uid - user id
RESULT
ret (D0) - return code
usergroup.library/setutent usergroup.library/setutent
NAME
setutent -- utmp database operations
SYNOPSIS
setutent();
void setutent (void);
FUNCTION
Rewind the utmp database
This function has been deprecated.
usergroup.library/ug_GetErr usergroup.library/ug_GetErr
NAME
ug_GetErr -- ret current error code
SYNOPSIS
ret = ug_GetErr();
D0
int ug_GetErr (void);
FUNCTION
Get the current error code (the value of the errno variable).
RESULT
ret (D0) - error
usergroup.library/ug_GetSalt usergroup.library/ug_GetSalt
NAME
ug_GetSalt -- generate settings for password encryption
SYNOPSIS
res = ug_GetSalt( user, buf, size );
D0 A0 A1 D0
char *ug_GetSalt( char *user, char *buf, unsigned long size );
FUNCTION
ug_GetSalt() creates a text string that is suitable to be passed to
the crypt() function as a settings string.
INPUTS
user - user
buf - buffer
size - size
RESULT
res (D0) - salt
usergroup.library/ug_SetupContextTagList
NAME
ug_SetupContextTagList -- set up process context
ug_SetupContextTags -- Varargs stub for ug_SetupContextTagList().
SYNOPSIS
ret = ug_SetupContextTagList( name, tags );
D0 A0 A1
int ug_SetupContextTagList( char *name, struct TagItem *tags );
ret = ug_SetupContextTags( name, name, ... );
int ug_SetupContextTags( char *name, char name, ... );
FUNCTION
ug_SetupContextTagList() and its varargs-equivalent,
ug_SetUpContextTags(), have the purpose of setting up some context
information for the calling process and changing default settings.
The first parameter is the program name, the second parameter is a
TagList. Currently the following TagItems are valid:
UGT_ERRNOPTR: link the process's errno variable to the errno variable
of usergroup.library (by passing a pointer to the process's errno
variable to usergroup.library).
UGT_ERRNOSIZE: specify the size of the process's errno variable.
Valid values are 1, 2 or 4.
UGT_INTRMASK: specify the interrupt signal mask. This TagItem
currently has no effect.
UGT_OWNER: changes the owner of the current library instance. You
should not normally need to use this tag. It is indented for unusual
versions of startup code only.
The return code is 0 for success and -1 for failure.
INPUTS
name - program name
tags - taglist
RESULT
ret (D0) - return code
usergroup.library/ug_StrError usergroup.library/ug_StrError
NAME
ug_StrError -- convert an error code into a text string
SYNOPSIS
ret = ug_StrError( err );
D0 D1
char *ug_StrError( int err );
FUNCTION
Return the text string associated with an error code.
INPUTS
err - error code
RESULT
ret (D0) - error string
usergroup.library/umask usergroup.library/umask
NAME
umask -- set file creation mode mask
SYNOPSIS
ret = umask( numask );
D0 D0
mode_t umask( mode_t numask );
FUNCTION
The umask() routine sets the process's file mode creation mask to
numask and returns the previous value of the mask.
The default mask value is 022.
The previous value of the file mode mask is returned by the call.
INPUTS
numask - new mask
RESULT
ret (D0) - old mask